Page({
  data: {
    boxlist:
      [
        {
          id: "addbook",
          name: "添加图书",
          url: "/images/add-fill.png"
        },
        {
          id: "books",
          name: "图书信息",
          url: "/images/tushu.png"
        },
        {
          id: "shoppingcart",
          name: "购物车",
          url: "/images/cart.png"
        },
        {
          id: "myorder",
          name: "我的订单",
          url: "/images/order.png"
        }
      ],
  },

  enterapplication: function (event) {
    var id = event.currentTarget.dataset.id
    var phone = wx.getStorageSync('phone');
    if(id == 'books')
    {
      wx.navigateTo({
        url: '../' + id + '/' + id
      });
    }
    else{
      if (phone == "") {
        wx.navigateTo({
          url: '../login/login'
        })
      }
      else {
        wx.navigateTo({
          url: '../' + id + '/' + id
        });
      }
    }
  },
})